import java.awt.Color;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import javax.swing.UIManager;


public class Human extends Player
{

	Human(Table T, Deck deck, String x, String y, int coins) 
	{
		super(T,deck, x, y, coins);
		
		C1.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				if(cardFlags[0] == 0) {
					C1.setForeground(Color.red);
					cardFlags[0] = 1;
				}
				else {
					C1.setForeground(Color.black);
					cardFlags[0] = 0;
				}
			}
		});
		
		C2.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				if(cardFlags[1] == 0) {
					C2.setForeground(Color.red);
					cardFlags[1] = 1;
				}
				else {
					C2.setForeground(Color.black);
					cardFlags[1] = 0;
				}
			}
		});
		
		C3.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				if(cardFlags[2] == 0) {
					C3.setForeground(Color.red);
					cardFlags[2] = 1;
				}
				else {
					C3.setForeground(Color.black);
					cardFlags[2] = 0;
				}
			}
		});
		
		C4.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				if(cardFlags[3] == 0) {
					C4.setForeground(Color.red);
					cardFlags[3] = 1;
				}
				else {
					C4.setForeground(Color.black);
					cardFlags[3] = 0;
				}
			}
		});
		
		C5.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				if(cardFlags[4] == 0) {
					C5.setForeground(Color.red);
					cardFlags[4] = 1;
				}
				else {
					C5.setForeground(Color.black);
					cardFlags[4] = 0;
				}
			}
		});
	}
	
	
	@Override
	void exchangeTime()
	{
		Ex_permission=0;
		ExchangeButton.setEnabled(true);
		ReadyButton.setEnabled(true);
		ExitButton.setEnabled(true);
		CheckButton.setEnabled(false);
		RaiseButton.setEnabled(false);
		CallButton.setEnabled(false);
		FoldButton.setEnabled(false);
		AllInButton.setEnabled(false);
		
		C1.setForeground(Color.black);
		C2.setForeground(Color.black);
		C3.setForeground(Color.black);
		C4.setForeground(Color.black);
		C5.setForeground(Color.black);
	}
	
	@Override
	void exchangeEnd()
	{
		Ex_permission=1;
		ExchangeButton.setEnabled(false);
		ReadyButton.setEnabled(false);
		ExitButton.setEnabled(false);
		CheckButton.setEnabled(false);
		RaiseButton.setEnabled(false);
		CallButton.setEnabled(false);
		FoldButton.setEnabled(false);
		AllInButton.setEnabled(false);
		
		C1.setForeground(UIManager.getColor("Button.background"));
		C2.setForeground(UIManager.getColor("Button.background"));
		C3.setForeground(UIManager.getColor("Button.background"));
		C4.setForeground(UIManager.getColor("Button.background"));
		C5.setForeground(UIManager.getColor("Button.background"));
	}
	
	@Override
	void bidTime() {
		
		ExchangeButton.setEnabled(false);
		ReadyButton.setEnabled(false);
		ExitButton.setEnabled(true);
		CheckButton.setEnabled(true);
		RaiseButton.setEnabled(true);
		CallButton.setEnabled(true);
		FoldButton.setEnabled(true);
		AllInButton.setEnabled(true);
		
		C1.setForeground(Color.black);
		C2.setForeground(Color.black);
		C3.setForeground(Color.black);
		C4.setForeground(Color.black);
		C5.setForeground(Color.black);
	}
	
	@Override
	void bidEnd() {
		
		ExchangeButton.setEnabled(false);
		ReadyButton.setEnabled(false);
		ExitButton.setEnabled(false);
		CheckButton.setEnabled(false);
		RaiseButton.setEnabled(false);
		CallButton.setEnabled(false);
		FoldButton.setEnabled(false);
		AllInButton.setEnabled(false);
		
		C1.setForeground(UIManager.getColor("Button.background"));
		C2.setForeground(UIManager.getColor("Button.background"));
		C3.setForeground(UIManager.getColor("Button.background"));
		C4.setForeground(UIManager.getColor("Button.background"));
		C5.setForeground(UIManager.getColor("Button.background"));
	}

}
